var express = require('express');
var path = require('path');
var logger = require('morgan');

var app = express();

app.use(logger('dev'));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
// 将 public 目录下的图片、CSS 文件、JavaScript 文件对外开放访问
app.use(express.static(path.join(__dirname, 'public')));

app.use('/order/order_list', require('./routes/order/order_list'))
app.use('/order/order_bg', require('./routes/order/order_bg'))
app.use('/order/detail_pic', require('./routes/order/detail_pic'))
app.use('/order/msg_board', require('./routes/order/msg_board'))
app.use('/order/order_publish', require('./routes/order/order_publish'))
app.use('/order/order_process', require('./routes/order/order_process'))
app.use('/order/updateState', require('./routes/order/updateState'))
app.use('/order/addMsg', require('./routes/order/addMsg'))
app.use('/order/upload', require('./routes/order/upload'))
app.use('/order/addOrder', require('./routes/order/addOrder'))

app.use('/take/takeOrder', require('./routes/take/takeOrder'))
app.use('/take/order_take', require('./routes/take/order_take'))

app.use('/user/login', require('./routes/user/login'))
app.use('/user/userinfo', require('./routes/user/userinfo'))
app.use('/user/updateUser', require('./routes/user/updateUser'))
app.use('/user/upload', require('./routes/user/upload'))
app.use('/user/rate', require('./routes/user/rate'))

app.use('/collect/isCollect', require('./routes/collect/isCollect'))
app.use('/collect/addCollect', require('./routes/collect/addCollect'))
app.use('/collect/delCollect', require('./routes/collect/delCollect'))
app.use('/collect/order_collect', require('./routes/collect/order_collect'))

app.use('/complain/addComplain', require('./routes/complain/addComplain'))

// 管理端接口
app.use('/order/order_list_admin', require('./routes/order/order_list_admin'))
app.use('/order/searchOrder', require('./routes/order/searchOrder'))
app.use('/order/deleteOrder', require('./routes/order/deleteOrder'))
// 和小程序端共用交易流程接口

app.use('/user/rate_list_admin', require('./routes/user/rate_list_admin'))
app.use('/user/user_list_admin', require('./routes/user/user_list_admin'))
app.use('/user/searchUser', require('./routes/user/searchUser'))
app.use('/user/login_admin', require('./routes/user/login_admin'))

app.use('/complain/complain_list_admin', require('./routes/complain/complain_list_admin'))
app.use('/complain/searchComplain', require('./routes/complain/searchComplain'))
app.use('/complain/dealComplain', require('./routes/complain/dealComplain'))





module.exports = app;